package com.huanong.service.impl;
/*
 *@Author:anran
 *@Date:2020/12/7
 *@Version 1.0
 */

import com.huanong.mapper.IntroductionMapper;
import com.huanong.pojo.Company;
import com.huanong.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private IntroductionMapper introductionMapper;

    @Override
    public List<Company> query() {
        return introductionMapper.companyQuery();
    }

    @Override
    public Company queryById(Integer CyId) {
        return introductionMapper.companyQueryById(CyId);
    }

    @Override
    public Integer add(Company company) {
        company.setCyTime(new Date());
        return introductionMapper.addCompany(company);
    }

    @Override
    public int delete(Integer CyId) {
        return introductionMapper.deleteCompany(CyId);
    }

    @Override
    public int update(Company company) {
        company.setCyTime(new Date());
        return introductionMapper.updateCompany(company);
    }

    @Override
    public Company queryNewMessage() {

        return introductionMapper.queryByTime();
    }
}
